import request from '@/utils/request'
import type { PageParam, ResponseData } from '../commonType'

enum API {
  INFO_URL = '/t-vessels-info/selectByModel',
  ALL_URL = '/t-vessels-info/getAll',
  PAGE_URL = '/t-vessels-info/getPage',
  ADD_URL = '/t-vessels-info/add',
  EDIT_URL = '/t-vessels-info/update',
  DELETE_URL = '/t-vessels-info/delete',
  getByld_URL = '/t-vessels-info/getById',
}

export function vesselsgetByld(data) {
  return request.get<any, ResponseData>(API.getByld_URL, { params: data })
}

export function vesselsGetAllByModel(model) {
  return request.get<any, ResponseData>(`${API.INFO_URL}/${model}`)
}

export function vesselsGetAll() {
  return request.get<any, ResponseData>(API.ALL_URL)
}

export function vesselsGetPage(data: PageParam) {
  return request.get<any, ResponseData>(API.PAGE_URL, { params: data })
}

export function vesselsAdd(data: any) {
  return request.post<any, ResponseData>(API.ADD_URL, data)
}

export function vesselsEdit(data: any) {
  return request.put<any, ResponseData>(API.EDIT_URL, data)
}

export function vesselsDelete(id: string | number) {
  return request.post<any, ResponseData>(`${API.DELETE_URL}/${id}`)
}
